﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net.Mail;

/// <summary>
/// Summary description for Utility
/// </summary>
public class Utility
{
    public Utility()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public static bool sendEmail(string email,string emailMsg)
    {
        MailMessage msgMail = new MailMessage();

        if (ConfigurationManager.AppSettings[Constants.ForgotPasswordFrom] != null)
            msgMail.From = new MailAddress(ConfigurationManager.AppSettings[Constants.ForgotPasswordFrom].ToString());
        msgMail.To.Add( new MailAddress(email));
        //msgMail.Cc = "webmaster@sleeper.Dev.AlfaSierraPapa.Com";
        msgMail.Subject = "VivahMuhurth";

        msgMail.IsBodyHtml = true;
        msgMail.Body = emailMsg;

        SmtpClient smtp = new SmtpClient("smtp.gmail.com");
        smtp.Port = 587;// 465;
        smtp.UseDefaultCredentials = false;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.Credentials = new System.Net.NetworkCredential("sanb313@gmail.com", "guddy35353535");//Or your Smtp Email ID and Password
        smtp.EnableSsl = true;

        smtp.Send(msgMail);

        return true;
    }
    public static string getForgotPasswordText(string fullName,string password)
    {
        string strMsg =
            "<html><body>Dear "+ fullName +" Please find your Vivahmatrimony password for your account: " +
           " <font color=\"blue\"><b>" + password + "</b></font></body></html>";

        return strMsg;
    }
    public static string getWelcomTextOnSignup(string fullName)
    {
        string strMsg =
            "<html><body>Congratulations, <font><b>" + fullName + "</b></font>,you have been successfully registered with Vivah Muhurtha. ";

        return strMsg;
    }
}
